package cheqex.update.controllers;

import java.util.List;

import cheqex.dao.LatestActivities;
import cheqex.dao.LatestActivitiesPeer;

public class ActivitiesController {
	
	public ActivitiesController(){
		
	}
	
	public static boolean addActivity(java.sql.Date date, String activity){
		try{
			if(LatestActivitiesPeer.addActivity(date, activity)) 
				return true;
			else return false;
		}catch(Exception e){
			e.printStackTrace();
			return false;
		}
	}
	
	public static int getID(){
		return LatestActivitiesPeer.getID();
	}
	
	public static String getActivity(int n){
		try{
			//int n = LatestActivitiesPeer.getID();
			List<LatestActivities> list = LatestActivitiesPeer.retrieveActivities(n);
			if(list!=null){
				LatestActivities remarks = list.get(0);
				return remarks.getActivity();
			}else return null;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	
	public static String getDate(int n){
		try{
			//int n = LatestActivitiesPeer.getID();
			List<LatestActivities> list = LatestActivitiesPeer.retrieveActivities(n);
			if(list!=null){
				LatestActivities remarks = list.get(0);
				return remarks.getDate().toString();
			} else return null;
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
}
